package 开始的剑指offer8月.双指针;
// https://leetcode-cn.com/problems/he-wei-sde-liang-ge-shu-zi-lcof/
public class 剑指Offer57和为s的两个数字0825 {
    class Solution {
        public int[] twoSum(int[] nums, int target) {
            int i = 0, j = nums.length - 1;
            while(i < j) {
                int s = nums[i] + nums[j];
                if(s < target) i++;
                else if(s > target) j--;
                else return new int[] { nums[i], nums[j] };
            }
            return new int[0];
        }
    }


}
